package com.czk.service.impl;

import com.czk.mapper.SpuMapper;
import com.czk.model.TbSpu;
import com.czk.service.SpuService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @Author:ChenZhangKun
 * @Date: 2021/10/20 16:22
 */
@Service
public class SpuServiceImpl implements SpuService {
    @Resource
    private SpuMapper spuMapper;

    @Override
    public TbSpu findById(String spuId) {
        return spuMapper.findById(spuId);
    }

    @Override
    public Page search(Map<String, String> searchMap, Integer page, Integer size) {
        // 设置分页参数
        PageHelper.startPage(page,size);
        List<TbSpu> search = spuMapper.search(searchMap);
        return (Page) search;
    }
}
